-- queen_transform
-- create by cheny3
-- 黑白皇后变身

return {
    apply = function(source, target, skillId, round, para, extra)
        if source.type ~= OBJECT_TYPE_MONSTER then
            return;
        end

        -- 转换后的classId
        local toClassId = para[1];
        if not toClassId then
            trace("astana_transform", "未配置转换后的id！");
            return;
        end

        -- 怪物变身
        -- 修改class_id, 技能
        source:setClassId(toClassId);
        source.dbase:set("class_id", toClassId);
        local skills = MonsterM.query(toClassId, "skills");
        source.dbase:set("skills", skills);

        -- 刷新属性
        PropM.refresh(source);

        -- 记录变身的回合
        source.dbase:set("transform_round", CombatM.getRound() - 1);

        -- 如果被变形了，需要清空变形的参数
        if source.dbase:query("changeClassId") then
            source.dbase:delete("changeClassId");
        end

        -- 有变身的状态，那么清空
        CombatStatusM.clearStatus(source, "transfiguration");

        -- 抛出变身事件
        EventMgr.fire(event.MONSTER_TRANSFORM, {["pos"] = source:getPos(), ["class_id"] = toClassId, });
    end,

    parse = function(desc)
        local arr = string.explode(desc, ",");
        return { tonumber(arr[1]), };
    end,

    -- 解析技能描述
    parseDesc = function(source, skillId, desc, para)
        return desc;
    end,
}

